//
//  BannerViewController.m
//  B
//
//  Created by Znt on 15/11/6.
//  Copyright © 2015年 wangzhan. All rights reserved.
//

#import "BannerViewController.h"

@interface BannerViewController ()

@property (nonatomic ,strong)UIWebView *webView;

@end

@implementation BannerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 375 *XWIDTH, 667 *XHIGHT - 64 -49)];
    
    self.webView.scalesPageToFit = YES;
    [self.view addSubview:self.webView];
    
    [self getWebData];
    
    UIImage *leftImage = [UIImage imageNamed:@"导航栏_button_back_用于白和灰.png"];
    leftImage = [leftImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:leftImage style:UIBarButtonItemStylePlain target:self action:@selector(leftButtonAction)];
    
}

-(void)leftButtonAction
{
    [self.navigationController popToRootViewControllerAnimated:NO];
}


- (void) getWebData
{
    
    
    NSString *strurl = [NSString stringWithFormat:@"%@",self.webUrl];
    NSURL *url = [NSURL URLWithString:strurl];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.webView loadRequest:request];
}


//- (void) getData {
//    
//    NSString *url_string = [NSString stringWithFormat:@"%@",self.webUrl];
//    
//    
//    AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
//    [session GET:url_string parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
//        
//        
//        
//        NSLog(@"成功");
//    } failure:^(NSURLSessionDataTask *task, NSError *error) {
//        NSLog(@"失败");
//    }];
//    
//    
//}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
